<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="物料料号">
              <a-input placeholder="请输入物料料号" v-model="queryParam.materid"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="区域编码">
              <a-input placeholder="请输入物区域编码" v-model="queryParam.areaCode"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="位置编码">
              <a-input placeholder="请输入物位置编码" v-model="queryParam.locationCode"></a-input>
            </a-form-item>
          </a-col>

          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- table区域-begin -->
    <div>
      <!--<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">-->
        <!--<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项-->
        <!--<a style="margin-left: 24px" @click="onClearSelected">清空</a>-->
      <!--</div>-->
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :scroll="{ x: 1500,y: 500  }"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="uploadFile(text)">
            下载
          </a-button>
        </template>

        <span slot="action" slot-scope="text, record">
          <a @click="handleDetail(record)">查看</a>
          <!--<a @click="handleEdit(record)">编辑</a>-->

          <!--<a-divider type="vertical" />-->
          <!--<a-dropdown>-->
            <!--<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>-->
            <!--<a-menu slot="overlay">-->
              <!--<a-menu-item>-->
                <!--<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">-->
                  <!--<a>删除</a>-->
                <!--</a-popconfirm>-->
              <!--</a-menu-item>-->
            <!--</a-menu>-->
          <!--</a-dropdown>-->
        </span>

      </a-table>
    </div>
  </a-card>
</template>

<script>

  import { httpAction,getAction } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import '@/assets/less/TableExpand.less'
import JDate from '@/components/jeecg/JDate.vue'

export default {
    name: 'CpJxcList',
    mixins: [JeecgListMixin],
    components: {
      JDate
    },
    data () {
        return {
          instrlist:{},
            description: '成品进销存',
            // 表头
            columns: [
                {
                    title: '序号',
                    dataIndex: '',
                    key: 'rowIndex',
                    width: 60,
                    align: 'center',
                    customRender: function (t, r, index) {
                        return parseInt(index) + 1
                    }
                },
              {
                title: '物料料号',
                align: 'center',
                dataIndex: 'attr1'
              },
              {
                title: '客户料号',
                align: 'center',
                dataIndex: 'attr2'
              },
              {
                title: '产品名称',
                align: 'center',
                dataIndex: 'attr3'
              },
              {
                title: '规格',
                align: 'center',
                dataIndex: 'attr4'
              },
//              {
//                title: '伏数',
//                align: 'center',
//                dataIndex: 'attr5'
//              },
//              {
//                title: '正负值',
//                align: 'center',
//                dataIndex: 'attr6'
//              },
              {
                title: '期初库存',
                align: 'center',
                dataIndex: 'attr7'
              },
              {
                title: '本月收入',
                align: 'center',
                dataIndex: 'attr8'
              },
              {
                title: '本年累计收入',
                align: 'center',
                dataIndex: 'attr9'
              },
              {
                title: '本月发出',
                align: 'center',
                dataIndex: 'attr10'
              },
              {
                title: '本年累计发出',
                align: 'center',
                dataIndex: 'attr11'
              },
              {
                title: '库存数量',
                align: 'center',
                dataIndex: 'attr12'
              },
              {
                title: '物料类型',
                align: 'center',
                dataIndex: 'attr13'
              },
              {
                title: '区域编码',
                align: 'center',
                dataIndex: 'attr14'
              },
              {
                title: '位置编码',
                align: 'center',
                dataIndex: 'attr15'
              },
            ],
            url: {
                list: '/storage/reportapi/selectCpJxc',
            },
            dictOptions: {}
        }
    },
    computed: {

    },
    methods: {
      initDictConfig () {

      },
    }
}
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
